﻿CREATE PROCEDURE [dbo].[yaf_category_list](
                @BoardID    INT,
                @CategoryID INT  = NULL)
AS
    BEGIN
        IF @CategoryID IS NULL
        SELECT   *
        FROM     yaf_Category
        WHERE    BoardID = @BoardID
        ORDER BY SortOrder
        ELSE
        SELECT *
        FROM   yaf_Category
        WHERE  BoardID = @BoardID
        AND CategoryID = @CategoryID
    END


